<div class="box box-default">
  <div class="box-body">
    <form class="form-inline">
      <div class="box box-default">
        <div class="form-group col-lg-12 col-md-12 col-sm-12 col-xs-12" style="padding-left:0px;margin-bottom:8px !important;">
          <button type="button" *ngIf="_.includes(menuResourceSet,'btn-otm-add')" class="btn btn-primary" (click)="create()">
            <i class="fa fa-edit"></i>创设新产品</button>
          <button type="button" *ngIf="_.includes(menuResourceSet,'btn-otm-start')" class="btn btn-primary" (click)="goRunning()">
            <i class="fa fa-flag-checkered"></i>开始运作</button>
          <button type="button" *ngIf="_.includes(menuResourceSet,'btn-otm-detail')" class="btn btn-primary" (click)="edit('one')">
            <i class="fa fa-edit"></i>查看</button>
          <button type="button" *ngIf="_.includes(menuResourceSet,'btn-otm-del')" class="btn btn-primary" (click)="delProduct()">
            <i class="iconfont icon-iconzhenghe62"></i>删除</button>
          <button type="button" *ngIf="_.includes(menuResourceSet,'btn-otm-export')" class="btn btn-primary" (click)="exportExcel()">
            <i class="fa fa-sign-out"></i>导出</button>
          <button type="button" class="btn btn-box-tool pull-right" data-widget="collapse">
            <i class="fa fa-minus"></i>
          </button>
        </div>
        <div class="box-body" style="display:block">
          <div class="form-group">
            <label class=" control-label">产品名称：</label>
            <input type="text" class="form-control" id="" name="sFullName" [(ngModel)]="getOnetomanyPost.sFullName" placeholder="产品名称">
          </div>
          <div class="form-group">
            <label class="control-label">产品代码：</label>
            <input type="text" class="form-control" id="" name="sFundCode" [(ngModel)]="getOnetomanyPost.sFundCode" placeholder="产品代码">
          </div>
          <div class="form-group col-lg-12" style="margin-top:5px">
            <label class="control-label">托管人：</label>
            <!-- <input type="text" class="form-control" maxlength="500" name="sTrustee" [(ngModel)]="getOnetomanyPost.sTrustee" placeholder="托管人"> -->
            <select class="form-control select2" maxlength="500" id="sTrusteeSelected" [(ngModel)]="getOnetomanyPost.sTrustee" name="sTrustee">
              <option [value]="''">--请选择--</option>
              <option [value]="item.sItemValue" *ngFor="let item of distionary.TRUSTEE">{{item.sItemValue}}</option>
            </select>
            <label class="control-label">产品状态：</label>
            <select class="form-control" name="sStatusRunning" [(ngModel)]="getOnetomanyPost.sStatusRunning">
              <option value="">全部</option>
              <option value="1">运行</option>
              <option value="0">暂停</option>
            </select>

            <!-- <select class="form-control" name="sStatusRunning" [(ngModel)]="getOnetomanyPost.sTrustee">
                          <option [value]="''" selected="selected">--全部--</option>
                          <option [value]="item.sInstiCode" *ngFor="let item of bankDictionaryList">{{item.sShortName}}</option>
                      </select> -->
            <button type="button" class="btn btn-primary" (click)="list(1)">
              <i class="fa fa-search"></i>查询</button>
          </div>
        </div>
      </div>
    </form>
    <!-- <hr> -->
    <div class="box-body" style="padding-left:0px;padding-right:0px;">
      <!-- updated by dujh @20180703 修改表格变为可拉伸 -->
      <div style="overflow-x:scroll;height:450px;" id="wclList" class="tbHeaderFix">
        <table class="table table-bordered table-hover table-keep-line table-striped">
          <thead>
            <tr>
              <th style="padding-left:20px !important;" class="width-5">
                <div class="checkbox checkbox-primary">
                  <input type="checkbox" id="checkboxAll" [(ngModel)]="isCheckedAll" (ngModelChange)="checkedAll()">
                  <label>
                  </label>
                </div>
              </th>
              <th class="width-8" (click)="orderData('sFundCode')">产品代码<i class="fa fa-sort"></i></th>
              <th class="width-22" (click)="orderData('sFundName')">产品简称<i class="fa fa-sort"></i></th>
              <th class="width-25" (click)="orderData('sTrustee')">托管人<i class="fa fa-sort"></i></th>
              <th class="width-15" (click)="orderData('sResearcher')">产品研究员<i class="fa fa-sort"></i></th>
              <th class="width-15" (click)="orderData('sFundCategoryZh')">产品类别<i class="fa fa-sort"></i></th>
              <th class="width-10" (click)="orderData('sStatusRunning')">产品状态<i class="fa fa-sort"></i></th>
            </tr>
          </thead>
          <tbody>
            <tr *ngFor="let item of onetomanyList">
              <td style="padding-left:20px !important;" class="width-5">
                <div class="checkbox checkbox-primary">
                  <input type="checkbox" name="checkbox1" id="checkbox1" [(ngModel)]="item.isChecked" (ngModelChange)="ctrlCheckAll()">
                  <label></label>
                </div>
              </td>
              <td class="width-8 short_name" (dblclick)="edit('dbclick',item)" [attr.title]="item.sFundCode">{{item.sFundCode}}</td>
              <td class="width-22 short_name" (dblclick)="edit('dbclick',item)" [attr.title]="item.sFullName">{{item.sFundName}}</td>
              <td class="width-25 short_name" (dblclick)="edit('dbclick',item)" [attr.title]="item.sTrustee">{{item.sTrustee}}</td>
              <td class="width-15 short_name" (dblclick)="edit('dbclick',item)" [attr.title]="item.sResearcher">{{item.sResearcher}}</td>
              <td class="width-15 short_name" (dblclick)="edit('dbclick',item)" [attr.title]="item.sFundCategoryZh">{{item.sFundCategoryZh}}</td>
              <td class="width-10 short_name">
                <a *ngIf="item.sStatusRunning=='1'" (click)="changeProductStatus('stop',item)" class="btn-xs btn-primary">
                  <i class="fa fa-play"></i>运行</a>
                <a *ngIf="item.sStatusRunning=='0'" (click)="changeProductStatus('run',item)" class="btn-xs btn-primary">
                  <i class="fa fa-pause"></i>暂停</a>
              </td>
            </tr>
          </tbody>
        </table>
      </div>
    </div>
    <div class="box-footer clearfix">
      <app-pagination [currentPageNum]="onetomanyListPageInfo.currentPageNum" [pagesShow]="" [totalPages]="onetomanyListPageInfo.totalPages"
        (pageChanged)="onetomanyPageNavigation($event)">
        <div class="pull-left pagination-detail" data-pagination-additional="true">
          <span class="pagination-info">
            当前显示第{{onetomanyListPageInfo.startRow}}到第{{onetomanyListPageInfo.endRow}}条，总共{{onetomanyListPageInfo.total}}条，
          </span>
          <span class="page-list">
            每页记录
            <span class="btn-group dropup">
              <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
                <span class="page-size">{{onetomanyListPageInfo.pageSize}}</span>
          <span class="caret"></span>
          </button>
          <ul class="dropdown-menu" role="menu">
            <li *ngFor="let i of onetomanyListPageInfo.pageList" role="menuitem" [class.active]="onetomanyListPageInfo.pageSize === i"
              (click)="onetomanypageSizeChange(i)">
              <a>{{i}}</a>
            </li>
          </ul>
          </span>条
          </span>
        </div>
      </app-pagination>
    </div>
  </div>
</div>

<!-- 开始运作模态框 -->
<div class="modal modal-detail" id="runProduct">
  <div class="modal-dialog modal-lg">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
        <h4 class="modal-title">开始运作</h4>
      </div>
      <form class="form-horizontal">
        <div class="modal-body">
          <div class="form-group">
            <label class="col-lg-2 text-right">
              <span class="span-style">*</span>产品代码</label>
            <div class="col-lg-3">
              <input class="form-control form-fields" type="text" [(ngModel)]="otmProductBody.sFundCode" name="sFundCode">
            </div>

          </div>
          <div class="form-group">
            <label class="col-lg-2 text-right">无固定期限:</label>
            <div class="col-lg-3">
              <div class="radio radio-info radio-inline">
                <input type="radio" id="inlineRadio1" value="1" name="sIsContractPeriod" [(ngModel)]="otmProductBody.sIsContractPeriod" (ngModelChange)="IsContractPeriod()">
                <label for="inlineRadio1">是</label>
              </div>
              <div class="radio radio-info radio-inline">
                <input type="radio" id="inlineRadio2" value="0" name="sIsContractPeriod" [(ngModel)]="otmProductBody.sIsContractPeriod" (ngModelChange)="IsContractPeriod()">
                <label for="inlineRadio2">否</label>
              </div>
            </div>
            <label class="col-lg-2 text-right">合同期限(月)</label>
            <div class="col-lg-3">
              <input class="form-control form-fields" [min]="0" maxlength="9" digits #nContractPeriod="ngModel" id="nContractPeriod" [(ngModel)]="otmProductBody.nContractPeriod"
                name="nContractPeriod" (ngModelChange)="countMonth()">
              <p *ngIf="nContractPeriod.errors?.digits" class="errorTip">请输入正整数</p>
            </div>
          </div>
          <div class="form-group">


            <label class="col-lg-2 text-right">
              <span class="span-style">*</span>起始运作日期</label>
            <div class="col-lg-3">
              <div class="input-group date form_datetime">
                <span class="input-group-addon">
                  <i class="fa fa-calendar"></i>
                </span>
                <input class="form-control" type="text" style="background: white; cursor: pointer;" [(ngModel)]="otmProductBody.dBegin" mwlFlatpickr
                  [ngModelOptions]="{standalone: false}" id="dBegin" name="dBegin" (ngModelChange)="countMonth()">
              </div>
            </div>
            <label class="col-lg-2 text-right">
              <span *ngIf="otmProductBody.sIsContractPeriod=='0'" class="span-style">*</span>到期日</label>
            <div class="col-lg-3">
              <div class="input-group date form_datetime">
                <span class="input-group-addon">
                  <i class="fa fa-calendar"></i>
                </span>
                <input class="form-control" type="text" style="background: white; cursor: pointer;" name="dEnd" [(ngModel)]="otmProductBody.dEnd"
                  mwlFlatpickr [ngModelOptions]="{standalone: false}">
              </div>
            </div>
          </div>

          <div class="form-group">
            <label class="col-lg-2 text-right">起始规模(亿元)</label>
            <div class="col-lg-3">
              <input class="form-control form-fields" [min]="0" #sFoundedSize="ngModel" maxlength="50" [(ngModel)]="otmProductBody.sFoundedSize"
                name="sFoundedSize">
              <p *ngIf="sFoundedSize.errors?.min" class="errorTip">请输入正数</p>
            </div>
            <label class="col-lg-2 text-right">投资者数量</label>
            <div class="col-lg-3">
              <input class="form-control form-fields" [min]="0" digits #nInvestorCount="ngModel" [(ngModel)]="otmProductBody.nInvestorCount"
                name="nInvestorCount" maxlength="9">
              <p *ngIf="nInvestorCount.errors?.digits" class="errorTip">请输入正整数</p>
            </div>
          </div>
        </div>
        <div class="modal-footer">
          <button type="button" class="btn btn-default pull-left" data-dismiss="modal">关闭</button>
          <button type="button" class="btn btn-primary" (click)="productRunning()" style="margin-top:20px" [disabled]="nContractPeriod.errors?.digits || sFoundedSize.errors?.min || nInvestorCount.errors?.digits">
            <i class="fa fa-save"></i>录入</button>
        </div>
      </form>
    </div>
  </div>